import hx.display.FPS;
import hx.display.Spine;
import hx.assets.Assets;
import hx.display.Stage;

class GameStage extends Stage {
	override function onStageInit() {
		super.onStageInit();
		// 代码开始的地方...
		this.topView.addChild(new FPS());
		var assets = new Assets();
		assets.loadSpineAtlas('assets/snowglobe-pro.png', 'assets/snowglobe-pro.atlas');
		assets.loadString('assets/snowglobe-pro.json');
		assets.onComplete((a) -> {
			var spine = new Spine(assets.getSkeletonData("snowglobe-pro"));
			this.addChild(spine);
			spine.x = this.stageWidth / 2;
			spine.y = this.stageHeight / 2 + 100;
			spine.animationState.setAnimationByName(0, "idle", true);
			spine.scaleX = spine.scaleY = 0.3;
		});
		assets.start();
	}
}
